import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:we_chat/pages/discover/discover_cell.dart';

class MinePage extends StatefulWidget {
  const MinePage({Key? key}) : super(key: key);

  @override
  State<MinePage> createState() => _MinePageState();
}

class _MinePageState extends State<MinePage> {
  //channel
  MethodChannel _methodChannel = MethodChannel("mine_page");
  
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      // appBar: AppBar(title: Text('我的页面'),),
      body: Stack(
        children: [
          Container(
            color: Color.fromRGBO(220, 220, 220, 1.0),
            child:MediaQuery.removePadding(
              removeBottom: true,//移除苹果刘海空隙
                context: context,
                child: ListView(
              children: [
                Container(
                  height: 140,
                  color: Colors.white,
                  child: Container(
                    // color: Colors.yellow,
                    margin: EdgeInsets.only(top: 40,bottom: 20),
                    // padding: EdgeInsets.all(10),
                    child: Container(
                      margin: EdgeInsets.only(left: 30),
                      padding: EdgeInsets.all(5),
                      // color: Colors.red,
                      child: Row(
                        children: [
                          Container(
                            height: 50,
                            width: 50,
                            decoration: BoxDecoration(
                              borderRadius: BorderRadius.circular(10.0),
                              image: DecorationImage (image: AssetImage('images/Jun.png'),
                                  // fit: BoxFit.cover//填充
                              )//圆角
                            ),
                            // child:Image (image: AssetImage('images/Hank.png'),),
                          ),//头像
                          Container(
                            width: MediaQuery.of(context).size.width-90,//获取屏幕宽度
                            padding: EdgeInsets.only(left: 10,top: 10,bottom: 10,right: 10),
                            child: Column(
                              crossAxisAlignment: CrossAxisAlignment.start,//水平方向
                              mainAxisAlignment: MainAxisAlignment.spaceBetween,//上下分开
                              children: [
                                GestureDetector(
                                  onTap:(){
                                    _methodChannel.invokeMapMethod('callNativeMethond');
                                },
                                  child: Container(
                                    child:  Text('Jun',style: TextStyle(fontSize: 16.0),textAlign: TextAlign.left,),
                                  ),
                                ),
                                Container(
                                  child: Row(
                                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                    children: [
                                    Text('微信号：123456',style: TextStyle(fontSize: 12,color: Colors.grey),),
                                    Image(image: AssetImage('images/icon_right.png'),width: 15,),

                                ],)
                                  ,),
                              ],
                            ),
                          ),//右边
                        ],
                      ),
                    ),
                  ),
                ),
                SizedBox(height: 10,),

                DiscoverCell(title: '支付', imageName: 'images/微信 支付.png'),
                SizedBox(height: 10,),

                DiscoverCell(title: '收藏', imageName: 'images/微信收藏.png'),
                DiscoverCell(title: '相册', imageName: 'images/微信相册.png'),
                DiscoverCell(title: '卡包', imageName: 'images/微信卡包.png'),
                DiscoverCell(title: '表情', imageName: 'images/微信表情.png'),
                SizedBox(height: 10,),

                DiscoverCell(title: '设置', imageName: 'images/微信设置.png'),

              ],
            )),
          ),

          Container(
            height: 25,
            // color: Color.fromRGBO(220, 220, 220, 1.0),
            margin: EdgeInsets.only(top: 40,right: 10),//偏移
            child: Row(
              mainAxisAlignment: MainAxisAlignment.end,
              children: [
                Image(image: AssetImage('images/相机.png')),
              ],

            ),
          ),
        ],
      ),
    );
  }
}
